import com.adobe.cairngorm.control.CairngormEventDispatcher;

import net.optix.ip.events.ProtectAsSecretEvent;
import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.InventionVO;

[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

private var _invention:InventionVO;

public function set invention(value:InventionVO):void
{
	_invention	=	value;
	try
	{
		if(_invention.clientID	==	model.client.clientID && model.role == 1)
		{
			this.visible	=	true;
		}
		else
		{
			this.visible	=	false;
		}
	}
	catch(error:Error)
	{
		this.visible	=	false;
	}
}

public function get invention():InventionVO
{
	return _invention;
}

public function showTrade():void
{
	model.bSubmit	=	false;
	var event:ProtectAsSecretEvent	=	new ProtectAsSecretEvent(_invention.inventionID,model.client.clientID);
	com.adobe.cairngorm.control.CairngormEventDispatcher.getInstance().dispatchEvent(event);
}
